<template>
	<view class="container">
		<!-- 以下为广告弹窗 -->
		<view class="index_dialog" v-if="isShowDialog">
			<image src="../../static/img/advertisement.png" class="dialog_banner"></image>
			<image src="../../static/icon/close_icon.png" class="dialog_close" @click="isShowDialog=false"></image>
		</view>

		<!-- 以下为客服咨询图片 -->
		<view class="right-bottom">
			<view v-if="isShowAdvice" class="lianxin">
				<view class="header">
					<view class="horizontal">
						<view class="line"></view>
						<view class="header-title">联系方式</view>
					</view>
					<image @click="isShowAdvice = false" class="close-icon" src="../../static/icon/close_icon.png"
						mode="widthFix"></image>
				</view>
				<view class="dividingLine"></view>
				<view class="lianxi-list">
					<view class="lianxi-item">
						<view class="lianxi-item-image">
							<image src="../../static/icon/wechat.png" mode="widthFix"></image>
						</view>
						<view class="lianxi-item-title">14865978219</view>
					</view>
					<view class="lianxi-item">
						<view class="lianxi-item-image">
							<image src="../../static/icon/phone.png" mode="widthFix"></image>
						</view>
						<view class="lianxi-item-title">15948753264</view>
					</view>
					<view class="lianxi-item">
						<view class="lianxi-item-image">
							<image src="../../static/icon/telephone.png" mode="widthFix"></image>
						</view>
						<view class="lianxi-item-title">400-6369-798</view>
					</view>
				</view>
			</view>

			<image @click="isShowAdvice = true" v-else class="seek" src="../../static/common/zixun.png" mode="widthFix">
			</image>
		</view>


		<!-- 以下为第一张图片 -->
		<view>
			<!-- <image src="../../static/img/baiyiweig.png" class="baiyi1"></image> -->
			<uni-section sub-title="" style="margin-top: -50rpx;margin-bottom: 20rpx;">
				<swiper :autoplay="true" :interval="3000" :duration="1000" style="height: 450rpx;width: 750rpx;">
					<swiper-item v-for="(item,index) in img" :key="index" :id="index">
						<image style="width: 100%;height: 100%;" :src="item.icon">
						</image>
					</swiper-item>
				</swiper>
			</uni-section>
		</view>



		<!-- 排列 -->
		<view class="flex_four">
			<view class="flex_menu">
				<image src="../../static/img/Frame_7.png" class="flex_menu_image" mode="widthFix"></image>
				<text class="flex_menu_title">热改楼盘</text>
			</view>
			<view class="flex_menu">
				<image src="../../static/img/Frame_5.png" class="flex_menu_image" mode="widthFix"></image>
				<text class="flex_menu_title">拎包入住</text>
			</view>
			<view class="flex_menu">
				<image src="../../static/img/Frame_6.png" class="flex_menu_image" mode="widthFix"></image>
				<text class="flex_menu_title">工地实景</text>
			</view>
			<view class="flex_menu">
				<image src="../../static/img/Frame 3.png" class="flex_menu_image" mode="widthFix"></image>
				<text class="flex_menu_title">保洁阿姨</text>
			</view>
		</view>

		<!-- 文字排列 -->

		<!-- 热改u楼盘排列 -->
		<view class="list2">
			<view class="list1">
				<view class="horizontal">
					<view class="line"></view>
					<text class="regai">热改楼盘</text>
				</view>
				<view class="horizontal">
					<text class="more-title" @click="detafour()">更多</text>
					<view class="more-icon">
						<image src="../../static/icon/right_icon.png" mode="widthFix"></image>
					</view>
				</view>
			</view>
			<!-- 图片排列 -->
			<view class="pailie">
				<view class="pailie2" v-for="(item,index) in buildList" :key="index" @click="dethree()">
					<image :src="item.thumb" class="img2" mode="aspectFill"></image>
					<view class="mark">
						<view style="margin-left: 13rpx;">{{item.name}}</view>
						<view class="op">{{item.model.name}}/{{item.style.name}}</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 排列 -->
		<!-- 热改u楼盘排列 -->
		<view class="list2">
			<view class="list1">
				<view class="horizontal">
					<view class="line"></view>
					<text class="regai">拎包入住</text>
				</view>
				<view class="horizontal">
					<text class="more-title" @click="check()">更多</text>
					<view class="more-icon">
						<image src="../../static/icon/right_icon.png" mode="widthFix"></image>
					</view>
				</view>
			</view>
			<!-- 图片排列 -->
			<view class="pailie">
				<view class="pailie2" v-for="(item,index) in comboList" :key="index">
					<image :src="item.thumb" class="img2" mode="aspectFill"></image>
					<view class="mark2">
						<view style="margin-left: 13rpx;">{{item.name}}</view>
						<view class="op">{{item.model}}m²</view>
						<view class="op">{{item.desc_str}}</view>
					</view>
				</view>
			</view>

			<!-- 工地实景 -->
			<view class="list3">
				<view class="list1">
					<view class="line"></view>
					<text class="regai">工地实景</text>
					<text class="more" @click="ex()">更多</text>
					<image src="../../static/icon/right_icon.png" class="right"></image>
				</view>
				<view class="pailie">
					<view class="pailie3" v-for="(item,index) in constructionList" :key="index" @click="deta()">
						<image :src="item.thumb" mode="aspectFill" class="img3"></image>
						<view class="mark3">
							<view style="margin-left: 13rpx;text-align: center;">{{item.name}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

				img: [{
						icon: '../../static/common/yuyue.png'
					},
					{
						icon: '../../static/img/baiyiweib.png'
					},
					{
						icon: '../../static/img/Mask group.png'
					}
				],
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 500,

				isShowDialog: true, //因为时广告，默认为true（显示）
				isShowAdvice: false,
				buildList: [],
				comboList: [],
				constructionList: []
			}
		},

		methods: {
			detafour() {
				uni.navigateTo({
					url: '/pages/details4/details4'
				})
			},
			detafours() {
				uni.navigateTo({
					url: '/pages/details4/details4'
				})
			},
			ex() {
				uni.navigateTo({
					url: "/pages/exterior/exterior"
				})
			},
			dethree() {
				uni.navigateTo({
					url: "/pages/detailss3/detailss3"
				})
			},
			check() {
				uni.navigateTo({
					url: "/pages/checkin/checkin"
				})
			},
			deta() {
				uni.navigateTo({
					url: "/pages/detail/detail"
				})
			}
		},
		onLoad() {
			uni.request({
				url: 'https://baiyi.kent.work/api/v1/system/getIndexData',
				method: 'post',
				data: {},
				success: res => {
					console.log(res);
					this.buildList = res.data.data.buildList,
						this.comboList = res.data.data.comboList,
						this.constructionList = res.data.data.constructionList
				},
				fail: () => {},
				complete: () => {}
			});
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		width: 100%;
		height: 100%;

		.index_dialog {
			width: 100%;
			height: 100vh;
			background: rgba(0, 0, 0, 0.5);
			position: fixed; //position:fixed指的是固定定位的意思
			z-index: 999; //相当于浮动在最上层
			display: flex;
			flex-direction: column; //项目排列方向为竖向
			align-items: center;
			justify-content: center; //水平居中

			.dialog_banner {
				width: 542rpx;
				height: 724rpx;
			}

			.dialog_close {
				width: 80rpx;
				height: 80rpx;
			}
		}

		.baiyi1 {
			height: 450rpx;
			width: 750rpx;
		}
	}

	.image1 {
		height: 80rpx;
		width: 80rpx;
		margin-left: 52rpx;
	}

	.text1 {
		margin-left: 52rpx;
	}

	.text2 {
		margin-left: 70rpx;
	}

	.flex_four {
		display: flex;
		flex-direction: row;

		.flex_menu {
			flex-direction: column;
			display: flex;
			align-items: center;
			flex: 1;
			
			.flex_menu_image{
				width: 80rpx;
			}
		}

		.image2 {
			margin-left: 110rpx;
			height: 80rpx;
			width: 80rpx;
		}
	}

	.list2 {
		height: 626rpx;
		width: 750rpx;
		background-color: white;
		margin-top: 40rpx;
	}

	.list1 {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding-right: 22px;
		padding-top: 12px;

		.line {
			display: inline-block; //取消单独占一行
			height: 28rpx;
			width: 6rpx;
			background-color: green;
			margin-left: 60rpx;
		}

		.regai {
			margin-left: 10rpx;
		}

		.more {
			margin-left: 460rpx;
		}

		.more-icon {
			width: 12px;
			margin-left: 5px;
		}

		.more-icon image {
			width: 100%;
			height: 100%;
		}

		.right {
			width: 25rpx;
			height: 25rpx;
		}
	}

	.pailie {
		display: flex;
		box-sizing: content-box;
		overflow-x: scroll;
		overflow-y: hidden;
		padding-left: 20rpx;

		.pailie2 {
			margin-left: 40rpx;
			margin-top: 20rpx;
			width: 382rpx;
			height: 520rpx;
			position: relative;
		}

		.pailie2 image {
			margin-right: 40rpx;
			width: 382rpx;
			height: 520rpx;
			border-radius: 8rpx 8rpx 8rpx 8rpx;
		}
	}

	.mark {
		color: white;
		position: absolute;
		background: rgba(0, 0, 0, 0.3);
		width: 382rpx;
		height: 96rpx;
		box-sizing: border-box;
		// margin-top: -110rpx;
		bottom: 0;
	}

	.mark2 {
		color: white;
		position: absolute;
		background: rgba(0, 0, 0, 0.3);
		width: 382rpx;
		// height: 150rpx;
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		bottom: 0;
		// margin-top: -160rpx;
		border-radius: 2%;
	}

	.list3 {
		// height: 626rpx;
		width: 800rpx;
		background-color: white;
		margin-top: 40rpx;
		padding-bottom: 136rpx;
	}

	.op {
		font-weight: 70;
		color: #ccc;
		opacity: 0.8;
		margin-left: 15rpx;
		//以下为文字两行显示，超出的部分代替为省略号
		text-overflow: -o-ellipsis-lastline;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.pailie3 {
		margin-left: 20rpx;
		margin-top: 20rpx;
		width: 520rpx;
		height: 304rpx;
		position: relative;
		box-sizing: border-box;
	}

	.img3 {
		margin-left: 20rpx;
		margin-top: 20rpx;
		width: 520rpx;
		height: 304rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
	}

	.mark3 {
		color: white;
		position: absolute;
		bottom: 0;
		background: rgba(0, 0, 0, 0.3);
		width: 520rpx;
		height: 50rpx;
		box-sizing: border-box;
		// margin-top: -60rpx;
		bottom: 0;
		border-radius: 4%;
		margin-left: 22rpx;
		border-radius: 0rpx 0rpx 10rpx 10rpx;
	}

	.right-bottom {
		position: fixed; //固定定位
		bottom: 132rpx;
		right: 20rpx;
		z-index: 888;
	}

	.seek {

		height: 221rpx;
		width: 182rpx;

		image {
			width: 100%;
		}

	}

	.lianxin {
		border-radius: 8px;
		background-color: rgba(255, 255, 255, 0.8);
		width: 181px;
		box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.4);

		.header {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 10px;

			.header-title {
				margin-left: 10px;
				font-size: 16px;
			}

			.close-icon {
				width: 22px;
				height: 22px;
			}
		}

		.line {
			height: 14px;
			width: 3px;
			background-color: #009900;
		}

	}

	.dividingLine {
		height: 1px;
		width: 100%;
		background-color: rgba(0, 0, 0, 0.05);
	}

	.lianxi-list {
		.lianxi-item:first-child {
			margin-top: 16px;
		}

		.lianxi-item:last-child {
			padding-bottom: 20px;
		}

		.lianxi-item {
			display: flex;
			margin-top: 10px;

			.lianxi-item-image {
				width: 22px;
				height: 22px;
				margin-left: 23px;
			}

			.lianxi-item-image image {
				width: 100%;
				height: 100%;
			}

			.lianxi-item-title {
				margin-left: 20px;
			}
		}
	}

	.horizontal {
		align-items: center;
		display: flex;
	}
</style>